import { Module } from '@nestjs/common';
// import { UsersService } from '../curd/user.services';
import { AuthController } from '../controllers/auth.controller';
import { PrismaModule } from '../prisma/prisma.module';
import { JwtService,JwtModule } from '@nestjs/jwt';
import { AuthService } from '@/curd/auth.service';
import { ConfigModule, ConfigService } from '@nestjs/config';

@Module({
  imports: [
    PrismaModule,
    JwtModule.registerAsync({
      imports: [ConfigModule],
      useFactory: async (configService: ConfigService) => ({
        secret: configService.get('JWT_SECRET'),
        signOptions: {
          expiresIn: configService.get('JWT_EXPIRES_IN'),
        },
      }),
      inject: [ConfigService],
      global: true, // 设为全局模块，方便在任何地方使用
    }),
  ],
  controllers: [AuthController],
  providers:[AuthService],
  exports: [JwtModule],
})
export class AuthModule {}
